/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.unisc.pdaapp.meta.ws;

/**
 * This interface is used in order to retrieve some necessary data
 * into moodle database for someone whose is trying to get some important
 * data about its moodle expirience.
 *
 * @author guilherme
 */
public interface IMoodleMobileWS
{
    public static final int SUCCES_LOGIN_TEACHER = 1;

    public static final int SUCCES_LOGIN_STUDENT = 2;

    public static final int FAILED_LOGIN = 0;

    /**
     * Does the login validation for the following user name and password.
     * 
     * @param userName The user name to check.
     * @param passwd The password to check.
     * @return
     */
    public int doLogin(String userName, String passwd);

    /**
     * Gets the courses of a moodle user.
     *
     * @param userName The user name of mdl_users table.
     * @return
     */
    public byte[] getCourses(String userName);

    /**
     * Gets a class.
     * A class means a register in mdl_course_section table.
     *
     * @param courseID The row id of mdl_course table.
     * @return
     */
    public byte[] getClasses(int courseID);

    /**
     * 
     * @param courseID
     * @param courseSectionID
     * @return
     */
    public byte[] getMaterial(int courseID, int courseSectionID);

    /**
     * Updates the class visibility.
     * A class means a register in mdl_course_section table.
     *
     * @param courseID The row id of mdl_course table.
     * @param courseSectionID The row id of mdl_course_sections table.
     * @param visible If the section will be visible or not.
     * @return
     */
    public int updateClassVisibility(int courseID, int courseSectionID, boolean visible);

    /**
     *
     * @param courseID
     * @param courseSectionID
     * @param courseModuleID
     * @param visible
     * @return
     */
    public int updateMaterialVisibility(int instance, int courseID, int courseSectionID, int courseModuleID, boolean visible);

    /**
     * Gets the messages of a user.
     *
     * @param userName The user to read some messages.
     * @return An byte array of messages.
     */
    public byte[] getMessages(String userName);

    /**
     * Sends a message from a user to some other users.
     *
     * @param fromUserName The one who is going to send a message.
     * @param destUsers The target users.
     * @param message The message.
     * @return
     */
    public int sendMessage(String fromUserName, String destUsers, String message);

    /**
     * Gets the user by course.
     *
     * @param courseID the course ID.
     * @return
     */
    public byte[] getUsersByCourse(int courseID);

    /**
     * Marks a message as read.
     * 
     * @param messageID
     * @return
     */
    public int deleteMessage(int messageID);

    public byte[] downloadMaterial(int courseID, String fileName);

    public int uploadMaterial(int courseID, int courseSectionID, String file, String fileName);
}
